import React from 'react';

import moment from 'moment'

import TopNavBar from 'components/TopNavBar';
import AnalysisTitle from 'components/AnalysisTitle';
import MyDatePicker from 'components/MyDatePicker'

import Indicators from './components/Indicators'
import Analysis from './components/Analysis'
import LineAnalysis from './components/lineAnalysis'

const nowTimeStamp = Date.now();
const now = new Date(nowTimeStamp);
const time = moment(now).format('YYYY')

class Project extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      time
    }
  }

  // 标题
  RenderNavBar = () => {
    const { route } = this.props;
    return <TopNavBar title={route.title} />;
  }

   // 切换指标
   handleChange = (time) => {
    this.setState({
      time
    })
  }

  render() {
    const { time } = this.state;
    return (
      <div>
        {this.RenderNavBar()}
        <Indicators />
        <AnalysisTitle />
        <MyDatePicker
          defaultValue = {time}
          onChange={this.handleChange}
        />
        <Analysis defaultValue = {time}/>
        <LineAnalysis defaultValue = {time} />
      </div>
    )
  }
}

export default Project;
